#ifndef SPRITE_H
#define SPRITE_H

#include "EngineApi.h"
#include "Entity.h"
#include "Texture.h"
#include "Animation.h"

class ENGINE_API Sprite : public Entity
{
public:
   Sprite(const std::string& name);
   void draw(Renderer* renderer);

   bool setTextureArea( UINT PositionX, UINT PositionY, UINT width, UINT height );
   void setTexture( Texture::TexturePtr texture ) { m_pTexture = texture; }
   Texture::TexturePtr getTexture() { return m_pTexture; }
   void clone (Sprite* sprite);

   void update(float timeBetweenFrames);

   bool setAnimation(std::string name);
   bool addAnimationInfo(std::string name, AnimationInfo::AnimationInfoPtr animationInfo);
   bool removeAnimationInfo(std::string name);
   AnimationInfo::AnimationInfoPtr getAnimationInfo(std::string name){ return m_animationMap[name]; }
   Animation* getAnimation(){ return m_pCurrentAnimation; }

   virtual void onCollision(Entity* collider);

private:
   Texture::TexturePtr m_pTexture;
   TextureVertex* m_pVertices;

   std::map<std::string, AnimationInfo::AnimationInfoPtr> m_animationMap;
   Animation* m_pCurrentAnimation;
};


#endif//SPRITE_H